package behavior.memento;

/**
 * @author dali
 * @date 2021-07-27 16:57
 * @Description
 */

public class Client {
    public static void main(String[] args) {
        Originator originator = new Originator();
        CareTaker careTaker = new CareTaker();
        //开始游戏
        System.out.println("开始游戏，杀死一个小怪得2分");
        //开始杀怪
        originator.kill();
        originator.kill();
        //显示目前游戏状态
        originator.getScore();
        //存档
        careTaker.saveMemento(originator.save());
        //退出游戏
        originator.exit();
        //显示目前游戏状态
        originator.getScore();
        //读档
        originator.restoreProcess(careTaker.getMemento(0));
        //显示目前游戏状态
        originator.getScore();
        //在杀
        originator.kill();
        //显示目前游戏状态
        originator.getScore();
    }

}
